﻿namespace WMS6.Web.Configuration
{
    using System;
    using System.Web.UI.HtmlControls;
    using System.Web.UI.WebControls;
    using WMS6.Web;

    public class AlternateSkuQuery : BasePage
    {
        protected Button btnList;
        protected Button btnSearch;
        protected DropDownList ddlAltSkuID;
        protected DropDownList ddlOwnerID;
        protected DropDownList ddlSkuID;
        protected DropDownList ddlVendorID;
        protected HtmlForm form1;
        protected HtmlInputHidden hdnActionID;
        protected HtmlHead Head1;
        protected Label lblAltSkuID;
        protected Label lblOwnerID;
        protected Label lblReceiptQuery;
        protected Label lblSkuID;
        protected Label lblVendorID;
        protected HtmlLink mycss;
        protected TextBox txtAltSkuID;
        protected TextBox txtOwnerID;
        protected TextBox txtSkuID;
        protected TextBox txtVendorID;

        protected void btnList_Click(object sender, EventArgs e)
        {
            base.Server.Transfer(string.Format("AlternateSkuList.aspx?action={0}&from=list", base.UrlEncode(this.hdnActionID.Value.Trim())), false);
        }

        protected void btnSearch_Click(object sender, EventArgs e)
        {
            base.Server.Transfer("AlternateSkuList.aspx?action=" + base.UrlEncode(this.hdnActionID.Value), false);
        }

        private void LoadDDl()
        {
            this.txtOwnerID.Text = base.Request.QueryString["OwnerID"];
            if ((base.Request.QueryString["VendorID"] != null) && !string.IsNullOrEmpty(base.Request.QueryString["VendorID"].ToString()))
            {
                this.txtVendorID.Text = base.Request.QueryString["VendorID"].ToString();
                this.txtVendorID.Enabled = false;
                this.ddlVendorID.Enabled = false;
            }
            base.InitQueryDDL(this.ddlAltSkuID, 0);
            base.InitQueryDDL(this.ddlOwnerID, 0);
            base.InitQueryDDL(this.ddlVendorID, 0);
            base.InitQueryDDL(this.ddlSkuID, 0);
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            base.InitPage(this.Page);
            this.LoadDDl();
        }

        public string AltSkuID
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtAltSkuID.Text.Trim()))
                {
                    return base.GetParamsString(this.txtAltSkuID.Text.Trim(), this.ddlAltSkuID.SelectedValue);
                }
                return "";
            }
        }

        public string OwnerID
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtOwnerID.Text.Trim()))
                {
                    return base.GetParamsString(this.txtOwnerID.Text.Trim(), this.ddlOwnerID.SelectedValue);
                }
                return "";
            }
        }

        public string SkuID
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtSkuID.Text.Trim()))
                {
                    return base.GetParamsString(this.txtSkuID.Text.Trim(), this.ddlSkuID.SelectedValue);
                }
                return "";
            }
        }

        public string VendorID
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtVendorID.Text.Trim()))
                {
                    return base.GetParamsString(this.txtVendorID.Text.Trim(), this.ddlVendorID.SelectedValue);
                }
                return "";
            }
        }
    }
}

